<template>
  <div class="p-3">
    <h2 v-html="art.title"></h2>
    <div class="text-grey" v-text="art.updateTime"></div>
    <div class="mt-3" v-html="art.contentNoencode"></div>

    <template v-if="!app && show">
      <div class="holder" style="height: 4.2142rem"></div>
      <footer class="flex-middle fixed-bottom bg-white py-2 px-3">
        <i class="iconfont icon-close text-grey font-xxl mr-3" @click="show = 0"></i>
        <img src="../assets/img/logo.png" style="max-height: 3rem">
        <div class="px-2">
          <div>粤红彩票</div>
          <small class="text-grey">您的中奖福地</small>
        </div>
        <button class="btn btn-danger ml-auto" @click="download">立即下载</button>
      </footer>
    </template>
  </div>
</template>

<script>
import http from '../http'

export default {
  name: 'art',
  data: () => ({
    show: 1,
    art: {}
  }),
  beforeRouteEnter (to, from, next) {
    http.post('/getArticleDetail', {id: to.query.id}).then(art => {
      next(vm => {
        document.title = art.title
        vm.art = art
      })
    })
  },
  methods: {
    download () {
      var ios = navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
      window.open('http://www.baidu.com')
    }
  }
}
</script>
